package com.ruoyi.ly.mapper;

import com.github.pagehelper.Page;
import com.ruoyi.ly.domain.Project;
import com.ruoyi.ly.domain.dto.PageProjectDTO;
import com.ruoyi.ly.domain.vo.AllProjectVO;
import com.ruoyi.ly.domain.vo.PageProjectVO;
import com.ruoyi.ly.domain.vo.ProjectUpdateVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProjectMapper {

    //分页查询
    Page<PageProjectVO> pageQuery(PageProjectDTO pageProjectDto);

    //添加项目
    void insert(Project project);

    //删除项目
    @Delete("delete from project where id = #{id}")
    void delete(Integer id);

    //修改项目
    void update(Project project);

    //根据项目id查询项目
    ProjectUpdateVO selectById(Long id);

    //对项目名称进行重名判断
    @Select("select count(1) from project where project_name = #{projectName}")
    Integer selectByRepeatName(String projectName);

    //查询所有企业和项目
    @Select("select distinct group_id from project")
    List<String> selectAllGroup();

    //根据企业id查询项目id和项目名称
    @Select("select id,project_name from project where group_id = #{groupId}")
    List<Project> selectByGroupId(String groupId);


}
